using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Condimar.Entities;

namespace Condimar.Repository.Mapping
{
    public class ProveedorMap : EntityTypeConfiguration<Proveedor>
    {
        public ProveedorMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Ruc)
                .HasMaxLength(11);

            this.Property(t => t.RazonSocial)
                .HasMaxLength(100);

            this.Property(t => t.Direccion)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("Proveedor");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Ruc).HasColumnName("Ruc");
            this.Property(t => t.RazonSocial).HasColumnName("RazonSocial");
            this.Property(t => t.Direccion).HasColumnName("Direccion");
        }
    }
}
